{include file="lib/header.html"}
<!--main-->
<div id="main">
  {include file="lib/history.html"}
	<div class="breadcrumb"><a href="?url=index">首页</a><img src="images/i.png" class="ico"> <a href="?url=building">区域</a> <img src="images/i.png" class="ico">楼宇列表</div>
	<div class="m10"><input name="" type="button" class="add" onclick=window.location.href='?url=building/create&prent_id={$prent_id}'></div>
	<div class="container m10">
		<form action="?url=building/delete" method="post" accept-charset="utf-8">
			<input type="hidden" name="prent_id" value="{$prent_id}"/>	
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<thead>
	<tr>
		<th><input type="checkbox" class="checkAll" /></th>
		<th>楼宇</th>
		<th>操作</th>
	</tr>
	</thead>
	{foreach $data as $val}
	<tr>
		<td><input type="checkbox" name="id[]" value="{$val.id}"></td>
		<td>{$val.name}</td>
		<td><a href="?url=building/update&id={$val.id}"><img src="images/i.png" class="edit" title="编辑"></a> <a href="?url=building/delete&id={$val.id}" class="delete"><img src="images/i.png" class="del" title="删除"></a></td>
	</tr>
	{/foreach}
</table>
</form>
	</div>
	<div class="m10">

		{if isset($pager)}
					<div class="pages fr">
						{if $pager->getPage() > 1}
						<a href="{$pager->link($pager->prev())}"><img src="images/i.png" class="prev"></a>
						{/if}
						{foreach $pager->getPagesArray(10) as $val}
							{if $pager->getPage() == $val}
								{$val}
							{else}
								<a href="{$pager->link($val)}">{$val}</a>
							{/if}
						{/foreach}
						{if !in_array($pager->getPages(), $pager->getPagesArray(10))}
						 <a href="javascript://">&middot;</a>
						 <a href="javascript://">&middot;</a>
						 <a href="javascript://">&middot;</a>
						<a href="{$pager->link($pager->end())}">{$pager->end()}</a>
						{/if}
						{if $pager->getPage() < $pager->getPages()}
							<a href="{$pager->link($pager->next())}"><img src="images/i.png" class="next"></a>
            {/if}
					</div>
				{/if}
				<select name="oper">
					<option value="0">选择操作</option>		
					<option value="?url=building/delete" >删除所有</option>
				</select>
				
	</div>

</div>
<script type="text/javascript" charset="utf-8">
$('.checkAll').click(function(){
  if (this.checked) {
    $('input[name=id[]]').checkbox('off');
  } else {
    $('input[name=id[]]').checkbox('on');
  }
});
$('select[name=oper]').change(function(){
	var url = $(this).val(); 
	if (url!=0) {
		if ($('input:checked[name=id[]]').size() < 1) {
			return false;
		}
		if (confirm('确定删除?此操作不能回退')) {
			$('form').attr('action', url).submit();
		};;
	};
});
</script>
<!--/main-->
{include file="lib/footer.html"}
